package com.bussanq.microsvc;

import org.apache.dubbo.config.annotation.Reference;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.PostConstruct;

/**
 * @author lizh
 * @date 2019/6/11
 */
@Controller
public class SvcController {

	@Reference(version = "1.0.0") //, url = "dubbo://localhost:20880"
	private HelloService demoService;

	@RequestMapping("/svc")
	@ResponseBody
	public String start(@RequestParam String word) {
		String sayHello = demoService.sayHello(word);
		System.err.println(sayHello);
		return sayHello;
	}

	@PostConstruct
	public void init() {
		String sayHello = demoService.sayHello("bussanq");
		System.err.println(sayHello);
	}
}
